/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gitee.fdc.mapper.entity;

import com.gitee.fdc.mapper.SbbsSqlHelper;
import tk.mybatis.mapper.entity.EntityColumn;
import tk.mybatis.mapper.entity.Example;

/**
 *
 * @author qskj
 */
public class SbbsExample extends Example {

    public SbbsExample(Class<?> entityClass) {
//        EntityColumn column = QsSqlHelper.findDeleteLogicColumn(entityClass);
        super(entityClass);
        EntityColumn column = SbbsSqlHelper.findDeleteLogicColumn(entityClass);
        if (column != null) {
            Criteria criteria = createCriteriaInternal();
            criteria.setAndOr("and");
            criteria.andEqualTo(column.getProperty(), 0);
            oredCriteria.add(criteria);
        }
    }

    @Override
    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            criteria.setAndOr("and");
            oredCriteria.add(criteria);
        } else {
            criteria.setAndOr("and");
            oredCriteria.add(criteria);
        }
        return criteria;
    }
}
